import os
import subprocess


if __name__ == '__main__':

    # 定义要执行的YAML用例文件，可指定多个执行
    yaml_files = [
        # 'data/xuanwu_yaml/node/test_node_a.yaml',
        # 'data/ctrler_yaml/test_logic_port.yaml',
        'data/xuanwu_yaml/node/test_node_add.yaml',
    ]

    for index, yaml_file in enumerate(yaml_files):
        # 设置环境变量，指定当前测试用例文件执行
        os.environ['TEST_CASES_FILE'] = yaml_file

        print(f"_____run test_____：{yaml_file}")

        # 使用subprocess调用pytest
        cmd = f'pytest -vs ./testCase'
        subprocess.run(cmd, shell=True)
